home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: cix.compulink.co.uk!usenet
- From: henri@cix.compulink.co.uk ("Henry Andrew")
- Subject: Re: Stack vs. Heap
- Message-ID: <DKLzyp.M19@cix.compulink.co.uk>
- Organization: IBM
- References: <30E556FB.20@zeta.org.au>
- Date: Wed, 3 Jan 1996 14:23:13 GMT
- X-News-Software: Ameol
-
- It seems to me that even if your objects are large (that is they contain
- a 'lot of'/'large' data members) the members can still come 'from the
- stack' because when you come to create your 'top level' object just do
- one 'new' and it all comes from the heap in one contiguous lump.
- 'new' and 'delete' are very important for dynamic structures the size (or
- extent) of which is not known at compile time like directory trees and
- other non-linear structures.
-
- Throwing exceptions can cause problems if function local variables are
- 'new'd as the 'delete' might get missed so leaving stuff in the heap.
- For Windows programs this is not a problem because if it runs out of heap
- we blame MS :-) For our servers which run non-stop we cannot leak into
- heap so we take a different view of 'new' and 'delete' and only use them
- when we have to.
-
- Yours &c. Henry
-